{% extends "base.html" %}

{% block title %}Your Servers{% endblock %}

{% block navdropdown %}
<div class="navbar-collapse navbar-responsive-collapse collapse" style="height: 1px;">
	<ul class="nav navbar-nav navbar-right">
		<li class="dropdown">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ lang.header_account }}<b class="caret"></b></a>
				<ul class="dropdown-menu">
					<li><a href="{{ settings.master_url }}logout.php">{{ lang.header_logout }}</a></li>
					{% if admin %}<li><a href="{{ settings.master_url }}admin/index.php">{{ lang.header_admin }}</a></li>{% endif %}
				</ul>
		</li>
	</ul>
</div>
{% endblock %}

{% block sidebar %}
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_acc_actions }}</strong></a>
	<a href="account.php" class="list-group-item">{{ lang.sidebar_settings }}</a>
	<a href="totp.php" class="list-group-item">TOTP {{ lang.sidebar_settings }}</a>
	<a href="servers.php" class="list-group-item active">{{ lang.sidebar_servers }}</a>
</div>
{% endblock %}

{% block content %}
<div class="col-9">
	{% if get.error is defined %}<div class="alert alert-danger">The requested server or function does not exist, or you do not have permission to access that server or function.</div>{% endif %}
	{% if servers[0]|length > 0 %}
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>{{ lang.string_node }}</th>
					<th>{{ lang.string_name }}</th>
					<th>{{ lang.string_connect }}</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				{% for server in servers %}
					<tr class="dynUpdate" id="{{ server.id }}">
						<td>{{ server.node_name }}</td>
						<td><a href="servers.php?goto={{ server.hash }}">{{ server.name }}</a></td>
						<td>{{ server.server_ip }}:{{ server.server_port }}</td>
						<td style="width:26px;"><i id="applyUpdate" class="fa fa-circle-o-notch fa-spinner fa-spin"></i></td>
					</tr>
				{% endfor %}
			</tbody>
		</table>
	{% else %}
		<div class="alert alert-info">
			You do not currently have any servers listed on your account.
		</div>
	{% endif %}
</div>
{% endblock %}
